/*
 * @Author: silence
 * @Date: 2023-07-11 11:40:04
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-10-18 08:48:40
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:sil_base_widget_package/sil_base_widget_package.dart';

import '../../../utils/color/ColorUtils.dart';

class SubmitBtn extends StatefulWidget {
  final String? title;
  final void Function()? onTapFunc;

  /// 最小高度，默认150
  final double? minWidth;

  /// 最小高度，默认45
  final double? minHeight;
  final EdgeInsetsGeometry? margin;

  const SubmitBtn(
      {this.margin,
      this.title,
      this.onTapFunc,
      this.minWidth,
      this.minHeight,
      super.key});

  @override
  State<SubmitBtn> createState() => _SubmitBtnState();
}

class _SubmitBtnState extends State<SubmitBtn> {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: widget.margin ?? EdgeInsets.only(top: 36.w, bottom: 80.w),
      child: contentView(),
    );
  }

  contentView() {
    return SilEmptyButton(
      useConstrained: false,
      margin: widget.margin,
      child: Container(
        constraints: BoxConstraints(
            minWidth: widget.minWidth ?? 150.w,
            minHeight: widget.minHeight ?? 45.w),
        alignment: Alignment.center,
        decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(23.w),
            boxShadow: [
              BoxShadow(
                  color: ColorUtils.hexColor('#40a7ba'),
                  offset: Offset(0.5.w, 1.5.w),
                  blurRadius: 5.w,
                  spreadRadius: 0.4.w)
            ],
            gradient: LinearGradient(
                begin: Alignment.centerLeft,
                end: Alignment.centerRight,
                colors: [
                  ColorUtils.hexColor('#70e8fd'),
                  ColorUtils.hexColor('#268496'),
                  // ColorUtils.color_theme_06,
                  // ColorUtils.hexColor('#268496'),
                ])),
        padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.w),
        child: SilText(
          widget.title,
          fontSize: 16.sp,
          color: ColorUtils.color_font_main,
        ),
      ),
      onTapFunc: widget.onTapFunc,
    );
  }
}
